Skip to content

feat: add streaming download functionality for large files in AsyncFiles class#109

Merged
adubovik merged 7 commits into
epam:developmentfrom
kryachkow:feat/91-streaming-downloads
Jun 25, 2026
Merged

feat: add streaming download functionality for large files in AsyncFiles class#109
adubovik merged 7 commits into
epam:developmentfrom
kryachkow:feat/91-streaming-downloads

Conversation

@kryachkow

@kryachkow kryachkow commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Applicable issues

Fixes #91

Description of changes

  • Added true async HTTP streaming support in AsyncHTTPClient via a new stream(...) context manager that uses stream=True and closes responses safely.
  • Added AsyncFiles.stream_download(...) to stream file downloads incrementally (without full buffering) while preserving existing error handling.
  • Added README example for stream_download() usage on large async downloads.
  • Added tests validating streamed chunk iteration, stream=True request behavior, response cleanup, and directory URL validation.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@kryachkow kryachkow requested a review from adubovik as a code owner June 11, 2026 09:04
Danylo_Kriachkov and others added 3 commits June 22, 2026 15:40
…aming-downloads

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	aidial_client/resources/files.py
Comment thread aidial_client/resources/files.py Outdated
Comment thread aidial_client/_http_client/_async.py
adubovik and others added 3 commits June 22, 2026 18:12
…oad request preparation

- Replaced inline error handling with a dedicated `_raise_for_status` method in both synchronous and asynchronous HTTP clients.
- Introduced `_prepare_download_request` method in `DialStorageResourceMixin` to encapsulate download request logic, improving code clarity and reusability.
- Updated type hints for `on_http_error` to use a consistent `ErrorHandler` type across the codebase.
- Simplified the error handling process by consolidating the raised error logic into a single line, enhancing readability and maintainability.
@adubovik adubovik merged commit 7677278 into epam:development Jun 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add streaming file downloads

2 participants